home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / GMS / GMSDev / Includes / graphics / blitter.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-11  |  16.3 KB  |  397 lines

  1. #ifndef GRAPHICS_BLITTER_H
  2. #define GRAPHICS_BLITTER_H TRUE
  3.  
  4. /*
  5. **  $VER: blitter.h V1.0
  6. **
  7. **  Blitter Definitions
  8. **
  9. **  (C) Copyright 1996-1998 DreamWorld Productions.
  10. **      All Rights Reserved
  11. */
  12.  
  13. #ifndef DPKERNEL_H
  14. #include <dpkernel/dpkernel.h>
  15. #endif
  16.  
  17. /***************************************************************************
  18. ** Bitmap Object.
  19. */
  20.  
  21. #define VER_BITMAP  1
  22. #define TAGS_BITMAP ((ID_SPCTAGS<<16)|ID_BITMAP)
  23.  
  24. typedef struct Bitmap {
  25.   struct Head Head;        /* [00] Standard structure header */
  26.   APTR   Data;             /* [12] Pointer to bitmap data area */
  27.   WORD   Width;            /* [16] Width */
  28.   WORD   ByteWidth;        /* [18] ByteWidth */
  29.   WORD   Height;           /* [20] Height */
  30.   WORD   Type;             /* [22] Screen type */
  31.   LONG   LineMod;          /* [24] Line differential */
  32.   LONG   PlaneMod;         /* [28] Plane differential */
  33.   struct Head    *Parent;  /* [32] Bitmap owner */
  34.   struct Restore *Restore; /* [36] Restore list for this bitmap, if any */
  35.   LONG   Size;             /* [40] Total size of the bitmap in bytes */
  36.   LONG   MemType;          /* [44] Memory type to use in allocation */
  37.   WORD   Planes;           /* [48] Amount of planes */
  38.   WORD   prvRes1;          /* [50] Reserved */
  39.   LONG   AmtColours;       /* [52] Maximum amount of colours available */
  40.   LONG   *Palette;         /* [56] Pointer to the Bitmap's palette */
  41.   LONG   Flags;            /* [60] Optional flags */
  42.  
  43.   /*** Private fields below ***/
  44.  
  45.   WORD   prvAFlags;        /* Allocation flags */
  46.   LONG   *prvPalette;      /* Allocated palette pointer */
  47.   LONG   prvBytePos;       /* Read/Write position */
  48.   LONG   prvPen;           /* Pen colour */
  49. } OBJ_BITMAP;
  50.  
  51. #define BMA_Data       (TAPTR|12)
  52. #define BMA_Width      (TWORD|16)
  53. #define BMA_Height     (TWORD|20)
  54. #define BMA_Type       (TWORD|22)
  55. #define BMA_Size       (TLONG|40)
  56. #define BMA_MemType    (TLONG|44)
  57. #define BMA_Planes     (TWORD|48)
  58. #define BMA_AmtColours (TLONG|52)
  59. #define BMA_Palette    (TAPTR|56)
  60. #define BMA_Flags      (TLONG|60)
  61.  
  62. /***************************************************************************
  63. ** Bitmap Types
  64. */
  65.  
  66. #define INTERLEAVED 1    /* Notice that these are numbers, not flags */
  67. #define ILBM        1
  68. #define PLANAR      2
  69. #define CHUNKY8     3
  70. #define CHUNKY16    4    /* %RRRRRGGG.GGGBBBBB */
  71. #define TRUECOLOUR  5    /* $AARR.GGBB */
  72.  
  73. /***************************************************************************
  74. ** Bitmap Flags.
  75. */
  76.  
  77. #define BMF_BLANKPALETTE 0x00000001  /* For a blank/black palette */
  78. #define BMF_EXTRAHB      0x00000002  /* Extra half brite */
  79. #define BMF_HAM          0x00000004  /* HAM mode */
  80.  
  81. /**************************************************************************/
  82.  
  83. #define PALETTE_ARRAY ((ID_PALETTE<<16)|01)
  84.  
  85. /***************************************************************************
  86. ** Restore Object.
  87. */
  88.  
  89. #define VER_RESTORE  1
  90. #define TAGS_RESTORE ((ID_SPCTAGS<<16)|ID_RESTORE)
  91.  
  92. typedef struct Restore {
  93.   struct Head Head;      /* Standard header */
  94.   WORD   Buffers;        /* Amount of screen buffers - 1, 2 or 3 */
  95.   WORD   Entries;        /* Amount of entries 1 ... 32k */
  96.   struct Head *Owner;    /* Owner of the restorelist, ie bitmap */
  97.  
  98.   /*** Private fields below ***/
  99.  
  100.   struct RstEntry *List1;
  101.   struct RstEntry *List2;
  102.   struct RstEntry *List3;
  103.   struct RstEntry *ListPos1;
  104.   struct RstEntry *ListPos2;
  105.   struct RstEntry *ListPos3;
  106. } OBJ_RESTORE;
  107.  
  108. /**** This structure is -completely- private ***/
  109.  
  110. struct RstEntry {
  111.   struct RstEntry *Next;  /* Next restore entry in the chain */
  112.   struct RstEntry *Prev;  /* Previous restore enty in the chain */
  113.   APTR   Bob;             /* Bob structure belonging to the restore [*] */
  114.   APTR   Address;         /* Screen pointer (top of screen) [*] */
  115.   APTR   Storage;         /* Background storage or NULL */
  116.   APTR   Control;         /* Controls from the lookup table */
  117.   APTR   ConMask;         /* The control mask to use */
  118.   WORD   Modulo1;         /* Modulo C */
  119.   LONG   Modulo2;         /* Modulos A/D */
  120.   WORD   BlitWidth;       /* [*] */
  121.   WORD   BlitHeight;      /* [*] */
  122. };
  123.  
  124. #define RSA_Buffers (12|TWORD)
  125. #define RSA_Entries (14|TWORD)
  126. #define RSA_Owner   (16|TAPTR)
  127.  
  128. /***************************************************************************
  129. ** Bob Object.
  130. */
  131.  
  132. #define VER_BOB  1
  133. #define TAGS_BOB ((ID_SPCTAGS<<16)|ID_BOB)
  134.  
  135. typedef struct  FrameList {
  136.   WORD  XCoord;
  137.   WORD  YCoord;
  138. } OBJ_FRAMELIST;
  139.  
  140. typedef struct Bob {
  141.   struct Head Head;             /* [00] Standard structure header */
  142.   LONG   emp1;                  /* [12] */
  143.   LONG   emp2;                  /* [16] */
  144.   struct FrameList *GfxCoords;  /* [20] Pointer to graphic frame coordinates */
  145.   WORD   Frame;                 /* [24] Current frame */
  146.   WORD   emp3;                  /* [26] */
  147.   WORD   Width;                 /* [28] Width in pixels */
  148.   WORD   ByteWidth;             /* [30] Width in bytes */
  149.   WORD   XCoord;                /* [32] To X pixel */
  150.   WORD   YCoord;                /* [34] To Y pixel */
  151.   WORD   Height;                /* [36] Height in pixels */
  152.   WORD   ClipLX;                /* [38] Left X border */
  153.   WORD   ClipTY;                /* [40] Top Y border */
  154.   WORD   ClipRX;                /* [42] Right X border */
  155.   WORD   ClipBY;                /* [44] Bottom Y border */
  156.   WORD   FPlane;                /* [46] 1st Plane to blit to (planar only) */
  157.   WORD   Planes;                /* [48] Amount of planes */
  158.   WORD   PropHeight;            /* [50] Expected height of source bitmap */
  159.   WORD   PropWidth;             /* [52] Expected width of source bitmap */
  160.   WORD   Buffers;               /* [54] Relevant only to restore mode */
  161.   LONG   PlaneSize;             /* [56] Size of source plane (planar only) */
  162.   LONG   Attrib;                /* [60] Attributes like CLIP and MASK */
  163.   struct Bitmap *SrcBitmap;     /* [64] Source Bitmap */
  164.   WORD   MBReserved1;           /* [68] Reserved, in use by MBob */
  165.   WORD   emp4;                  /* [70] */
  166.   APTR   Source;                /* [72] Pointer to source object */
  167.   APTR   *DirectGfx;            /* [76] Pointer to direct frame list */
  168.   struct Bitmap    *DestBitmap; /* [80] Destination Bitmap */
  169.   struct FrameList *MaskCoords; /* [84] Pointer to mask frame coordinates */
  170.   APTR   *DirectMasks;          /* [88] Pointer to direct frame list */
  171.   struct Bitmap *MaskBitmap;    /* [92] */
  172.   WORD   AmtFrames;             /* [96] Amount of frames in frame/direct list */
  173.  
  174.   /*** Private fields start now ***/
  175.  
  176.   WORD   prvStoreSize;       /* 4/8/12 Sizeof one store entry (MBob's) */
  177.   APTR   prvStoreBuffer;     /* A/B/C [0/4/8] storage pointer (MBob's) */
  178.   WORD   prvStoreMax;        /* Maximum store position */
  179.   APTR   prvStoreMemory;     /* Master storage pointer (for the freemem) */
  180.   WORD   prvStoreCount;      /* Counter for store, 0, 4, 8 */
  181.   BYTE   *prvStoreA;         /* Storage buffer 1 */
  182.   BYTE   *prvStoreB;         /* Storage buffer 2 */
  183.   BYTE   *prvStoreC;         /* Storage buffer 3 */
  184.   APTR   prvDrawRoutine;     /* Routine for drawing/clearing/storing */
  185.   APTR   prvClearRoutine;    /* Routine for clearing */
  186.   APTR   prvRestoreRoutine;  /* Routine for restoring/clearing */
  187.   APTR   prvHeightRoutine;   /* Replaces BS_DrawRoutine for large heights */
  188.   LONG   prvScreenSize;      /* Size of destination plane */
  189.   WORD   prvModulo;          /* Bob Modulo (PicWidth-BobWidth) */
  190.   WORD   prvMaskModulo;      /* Mask Modulo (BobWidth-BobWidth for GENMASK) */
  191.   APTR   prvMaskMemory;      /* Master mask pointer (for the freemem) */
  192.   WORD   prvMaxHeight;       /* Maximum possible height, limited by blitter */
  193.   WORD   prvScrLine;         /* Size of a line (for interleaved) */
  194.   WORD   prvBobLine;         /* Size of a Bob line (Width*Planes) */
  195.   WORD   prvMaskLine;        /* Size of a Mask Line (Width*Planes) */
  196.   WORD   prvTrueWidth;       /* The true pixel width (++shift) */
  197.   WORD   prvTrueBWidth;      /* The true byte width (++shift) */
  198.   WORD   prvTrueWWidth;      /* The true word width (++shift) */
  199.   WORD   prvClipBLX;         /* ClipLX, byte */
  200.   WORD   prvClipBRX;         /* ClipRX, byte */
  201.   WORD   prvModuloC;         /* Modulus (C) */ 
  202.   WORD   prvModuloB;         /* Modulus (B) */ 
  203.   WORD   prvModuloA;         /* Modulus (A) */
  204.   WORD   prvModuloD;         /* Modulus (D) */
  205.   WORD   prvNSModuloC;       /* NSModulus (C) */ 
  206.   WORD   prvNSModuloB;       /* NSModulus (B) */ 
  207.   WORD   prvNSModuloA;       /* NSModulus (A) */ 
  208.   WORD   prvNSModuloD;       /* NSModulus (D) */ 
  209.   WORD   prvWordWidth;       /* The word width */
  210.   BYTE   prvAFlags;          /* Allocation flags */
  211.   BYTE   prvPad;             /* Empty */
  212.   struct GScreen *prvScreen; /* Destination Screen (Private) */
  213.   BYTE   *prvMaskData;
  214.   WORD   prvSrcWidth;         /* Source Page Width in bytes */
  215.   WORD   prvSrcMaskWidth;     /* Mask page width in bytes */
  216. } OBJ_BOB;
  217.  
  218. #define BBA_GfxCoords    (20|TAPTR)
  219. #define BBA_Frame        (24|TWORD)
  220. #define BBA_Width        (28|TWORD)
  221. #define BBA_XCoord       (32|TWORD)
  222. #define BBA_YCoord       (34|TWORD)
  223. #define BBA_Height       (36|TWORD)
  224. #define BBA_ClipLX       (38|TWORD)
  225. #define BBA_ClipTY       (40|TWORD)
  226. #define BBA_ClipRX       (42|TWORD)
  227. #define BBA_ClipBY       (44|TWORD)
  228. #define BBA_FPlane       (46|TWORD)
  229. #define BBA_Planes       (48|TWORD)
  230. #define BBA_PropHeight   (50|TWORD)
  231. #define BBA_PropWidth    (52|TWORD)
  232. #define BBA_Buffers      (54|TWORD)
  233. #define BBA_Attrib       (60|TLONG)
  234. #define BBA_SrcBitmap    (64|TWORD)
  235. #define BBA_Source       (72|TAPTR)
  236. #define BBA_MaskCoords   (84|TAPTR)
  237. #define BBA_MaskBitmap   (92|TAPTR)
  238.  
  239. #define BBA_SourceTags   (TSTEPIN|TTRIGGER|72)
  240.  
  241. /***********************************************************************************/
  242.  
  243. #define VER_MBOB  1
  244. #define TAGS_MBOB ((ID_SPCTAGS<<16)|ID_MBOB)
  245.  
  246. typedef struct MBob {
  247.   struct Head Head;              /* [00] Standard structure header */
  248.   APTR   emp1;                   /* [12] */
  249.   APTR   emp2;                   /* [16] */
  250.   struct FrameList *GfxCoords;   /* [20] Pointer to graphics frame list */
  251.   WORD   AmtEntries;             /* [24] Amount of entries in the list */
  252.   WORD   emp3;                   /* [26] */
  253.   WORD   Width;                  /* [28] Width in pixels (optional) */
  254.   WORD   ByteWidth;              /* [30] Width in bytes */
  255.   struct MBEntry *EntryList;     /* [32] :MB: Pointer to entry list */
  256.   WORD   Height;                 /* [36] Height in pixels */
  257.   WORD   ClipLX;                 /* [38] Left X border */
  258.   WORD   ClipTY;                 /* [40] Top Y border */
  259.   WORD   ClipRX;                 /* [42] Right X border */
  260.   WORD   ClipBY;                 /* [44] Bottom Y border */
  261.   WORD   FPlane;                 /* [46] 1st Plane to blit to (planar only) */
  262.   WORD   Planes;                 /* [48] Amount of planes */
  263.   WORD   PropHeight;             /* [50] Expected height of source picture */
  264.   WORD   PropWidth;              /* [52] Expected width of source picture */
  265.   WORD   Buffers;                /* [54] Relevent only to restore mode */
  266.   LONG   PlaneSize;              /* [56] Size of source plane (planar only) */
  267.   LONG   Attrib;                 /* [60] Attributes like CLIP and MASK */
  268.   struct Bitmap *SrcBitmap;      /* [64] Source Bitmap */
  269.   WORD   EntrySize;              /* [68] Entry size (sizeof(struct MBEntry)) */
  270.   WORD   emp4;                   /* [70] */
  271.   APTR   Source;                 /* [72] Pointer to source object */
  272.   LONG   *DirectGfx;             /* [76] Pointer to direct frame list (R) */
  273.   struct Bitmap    *DestBitmap;  /* [80] The MBob's destination Bitmap */
  274.   struct FrameList *MaskCoords;  /* [84] Pointer to masks frame list */
  275.   LONG   *DirectMasks;           /* [88] Pointer to direct frame list (R) */
  276.   struct Bitmap *MaskBitmap;     /* [92] */
  277.   WORD   AmtFrames;              /* [96] Amount of frames in frame/direct list */
  278.  
  279.   /*** Private fields start now ***/
  280.  
  281.   WORD   prvStoreSize;        /* 4/8/12 Sizeof one store entry (MBob's) */
  282.   APTR   prvStoreBuffer;      /* A/B/C [0/4/8] storage pointer (MBob's) */
  283.   WORD   prvStoreMax;         /* Maximum store position */
  284.   APTR   prvStoreMemory;      /* Master storage pointer (for the freemem) */
  285.   WORD   prvStoreCount;       /* Counter for store, 0, 4, 8 */
  286.   APTR   prvStoreA;           /* Storage buffer 1 */
  287.   APTR   prvStoreB;           /* Storage buffer 2 */
  288.   APTR   prvStoreC;           /* Storage buffer 3 */
  289.   APTR   prvDrawRoutine;      /* Routine for drawing/clearing/storing */
  290.   APTR   prvClearRoutine;     /* Routine for clearing */
  291.   APTR   prvRestoreRoutine;   /* Routine for restoring/clearing */
  292.   APTR   prvHeightRoutine;    /* Replaces BS_DrawRoutine for large heights */
  293.   LONG   prvScreenSize;       /* Size of destination plane */
  294.   WORD   prvModulo;           /* Bob Modulo (PicWidth-BobWidth) */
  295.   WORD   prvMaskModulo;       /* Mask Modulo (BobWidth-BobWidth for GENMASK) */
  296.   APTR   prvMaskMemory;       /* Master mask pointer (for the freemem) */
  297.   WORD   prvMaxHeight;        /* Maximum possible height, limited by blitter */
  298.   WORD   prvScrLine;          /* Size of a line (for interleaved) */
  299.   WORD   prvBOBLine;          /* Size of a Bob line (Width*Planes) */
  300.   WORD   prvMaskLine;         /* Size of a Mask Line (Width*Planes) */
  301.   WORD   prvTrueWidth;        /* The true pixel width (++shift) */
  302.   WORD   prvTrueBWidth;       /* The true byte width (++shift) */
  303.   WORD   prvTrueWWidth;       /* The true word width (++shift) */
  304.   WORD   prvClipBLX;          /* ClipLX, byte */
  305.   WORD   prvClipBRX;          /* ClipRX, byte */
  306.   LONG   prvModulo1;          /* Modulus (C/B) */ 
  307.   LONG   prvModulo2;          /* Modulus (A/D) */ 
  308.   LONG   prvNSModulo1;        /* Modulus (C/B) */ 
  309.   LONG   prvNSModulo2;        /* Modulus (A/D) */ 
  310.   WORD   prvWordWidth;        /* The word width */
  311.   BYTE   prvAFlags;           /* Allocation flags */
  312.   BYTE   prvPad;              /* Empty */
  313.   struct GScreen *prvScreen;  /* The MBob's destination Screen */
  314.   BYTE   *prvMaskData;
  315.   WORD   prvSrcWidth;         /* Source Page Width in bytes */
  316.   WORD   prvSrcMaskWidth;     /* Mask page width in bytes */
  317. } OBJ_MBOB;
  318.  
  319. #define MBA_GfxCoords    (20|TAPTR)
  320. #define MBA_AmtEntries   (24|TWORD)
  321. #define MBA_Width        (28|TWORD)
  322. #define MBA_EntryList    (32|TAPTR)
  323. #define MBA_Height       (36|TWORD)
  324. #define MBA_ClipLX       (38|TWORD)
  325. #define MBA_ClipTY       (40|TWORD)
  326. #define MBA_ClipRX       (42|TWORD)
  327. #define MBA_ClipBY       (44|TWORD)
  328. #define MBA_FPlane       (46|TWORD)
  329. #define MBA_Planes       (48|TWORD)
  330. #define MBA_PropHeight   (50|TWORD)
  331. #define MBA_PropWidth    (52|TWORD)
  332. #define MBA_Buffers      (54|TWORD)
  333. #define MBA_Attrib       (60|TLONG)
  334. #define MBA_SrcBitmap    (64|TAPTR)
  335. #define MBA_EntrySize    (68|TWORD)
  336. #define MBA_Source       (72|TAPTR)
  337. #define MBA_MaskCoords   (84|TAPTR)
  338. #define MBA_MaskBitmap   (92|TAPTR)
  339.  
  340. /***************************************************************************/
  341.  
  342. typedef struct MBEntry {        /* MBob Entry Structure */
  343.   WORD XCoord;
  344.   WORD YCoord;
  345.   WORD Frame;
  346. } OBJ_MBENTRY;
  347.  
  348. #define MBE_SIZEOF (sizeof(struct MBEntry))
  349.  
  350. /* Bob Attributes (Bob.Attrib) */
  351.  
  352. #define BBF_CLIP      0x00000001 /* Allow border clipping */
  353. #define BBF_MASK      0x00000002 /* Allow masking */
  354. #define BBF_STILL     0x00000004 /* This bob is not moving */
  355. #define BBF_CLEAR     0x00000008 /* Allow automatic clearing */
  356. #define BBF_RESTORE   0x00000010 /* Allow automatic background restore */
  357. /*#define           0x00000020   */
  358. #define BBF_FILLMASK  0x00000040 /* Fill any holes in the mask on generation */
  359. #define BBF_GENONLY   0x00000080 /* Create masks but do not use them yet */
  360. #define BBF_GENMASKS  0x00000082 /* Create and use masks for drawing this bob */
  361. #define BBF_CLRMASK   0x00000100 /* Use masks when clearing */
  362. #define BBF_CLRNOMASK 0x00000000 /* Do not use masks when clearing (default) */
  363.  
  364. #define BBF_GENMASK BBF_GENMASKS /* Synonym */
  365.  
  366. #define SKIPIMAGE 32000
  367.  
  368. /****************************************************************************
  369. ** Pixel list structures.
  370. */
  371.  
  372. typedef struct PixelEntry {
  373.   WORD XCoord;
  374.   WORD YCoord;
  375.   LONG Colour;
  376. } OBJ_PIXELENTRY;
  377.  
  378. typedef struct PixelList {
  379.   WORD   AmtEntries;
  380.   WORD   EntrySize;
  381.   struct PixelEntry *Pixels;
  382. } OBJ_PIXELLIST;
  383.  
  384. #define SKIPPIXEL -32000
  385. #define PIXELLIST(a)
  386.  
  387. /***************************************************************************/
  388.  
  389. #define BSORT_X         0x00000001
  390. #define BSORT_Y         0x00000002
  391. #define BSORT_DOWNTOP   0x00000004  /* From Bottom to top */
  392. #define BSORT_RIGHTLEFT 0x00000008  /* Right to Left */
  393. #define BSORT_LEFTRIGHT 0x00000000  /* Default */
  394. #define BSORT_TOPDOWN   0x00000000  /* Default */
  395.  
  396. #endif /* GRAPHICS_BLITTER_H */
  397.